const http = require('http');
const server = http.createServer();

server.on('request',(req,res)=>{
    let url = req.url;
    let content = '<h1>404 NotFind</h1>';
    if(url == "/index.html" || url == "/"){
        content = "你好！这是首页！"
    }else if(url == '/about.html'){
        content = "你好，关于页面请看这里！"
    };
    res.setHeader('Content-Type' ,'text/html; charset=utf-8')


    res.end(content)
});
server.listen("8081",()=>{
    console.log("即将访问：http://127.0.0.1:8081");
})